Skip to content

feat: rebuild NeoCode MVP around runtime-centric architecture#68

Closed
wynxing wants to merge 9 commits into
1024XEngineer:mainfrom
wynxing:codex/pr-main-architecture
Closed

feat: rebuild NeoCode MVP around runtime-centric architecture#68
wynxing wants to merge 9 commits into
1024XEngineer:mainfrom
wynxing:codex/pr-main-architecture

Conversation

@wynxing

@wynxing wynxing commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

变更目的

本 PR 将当前实现重构为面向 NeoCode Coding Agent MVP 的最小可用架构,聚焦跑通以下主链路:

用户输入 -> Agent 推理 -> 调用工具 -> 获取结果 -> 继续推理 -> UI 展示

重构目标是统一边界、收敛职责,并为后续扩展 provider、tools 和会话能力打下稳定基础。

涉及模块

  • config
  • provider
  • runtime
  • tools
  • tui
  • app/bootstrap

主要变更

1. 重建 MVP 项目结构

按新的目标结构重组代码,核心目录调整为:

  • cmd/neocode
  • internal/app
  • internal/config
  • internal/provider
  • internal/runtime
  • internal/tools
  • internal/tui
  • docs

2. 以 Runtime 为唯一编排中心

新架构下由 runtime 统一负责:

  • 会话上下文维护
  • prompt 组装
  • 模型调用编排
  • tool call 执行与结果回灌
  • 事件分发
  • loop 停止条件控制

避免了 TUI、provider、tools 之间的跨层直连。

3. 收敛 Provider / Tools / TUI 职责

  • provider 仅负责模型协议适配、请求响应转换和流式/错误处理
  • tools 提供统一的 schema + execute + result 抽象
  • tui 只负责交互与渲染,改为消费 runtime 事件,不再直接承担模型调用或工具执行

4. 实现 MVP 主链路闭环

当前版本已具备以下能力:

  • 启动时加载并校验配置
  • 接入至少一个 provider(OpenAI)
  • 注册并执行工具
  • 将 tool result 回灌模型继续推理
  • 在 TUI 中展示基础会话内容与运行状态

5. 补充测试与文档

补充并更新了与新架构对应的:

  • 配置校验测试
  • provider 测试
  • runtime 测试
  • filesystem tool 测试
  • TUI 测试
  • MVP 架构与交互文档

是否影响主链路

是。

这是一次围绕 MVP 的架构级重建,直接调整了 TUI / Runtime / Provider / Tools / Config 的职责分工,并替换了旧的实现组织方式。

是否影响配置

是。

配置模型和启动校验逻辑已按新架构重建,请以上游评审结果为准确认是否还需要补充迁移说明。

已运行测试

go test ./...
go build ./...
image image

@minorcell minorcell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yumiue

Comment thread .github/workflows/ci.yml
Comment thread docs/neo-code-coding-agent-mvp-arch-design.md
Comment thread internal/app/bootstrap.go Outdated
Comment thread internal/app/bootstrap.go Outdated
Comment thread internal/config/validate.go
Comment thread internal/provider/provider.go
Comment thread internal/tools/filesystem/write_file.go
Comment thread internal/tools/registry.go Outdated
Comment thread internal/tui/view.go Outdated
Comment thread docs/neo-code-coding-agent-mvp-arch-design.md
wynxing added 6 commits March 27, 2026 10:03
- 让 tools.Registry 只负责注册、schema 暴露和查找
- 新增 tools.Executor,统一工具执行结果与错误包装
- runtime 显式注入 tool catalog 和 tool executor
- 将 tui 视图按 theme、panel、root、conversation、runtime 拆分文件
- 补充工具执行归一化、tool error 流程和 tui 渲染 smoke 测试
- 同步 README 和架构文档中的职责说明
- 新增 fs_edit_file,支持对已有文本文件做精确片段替换
- 限制编辑路径必须位于 workdir 内,并校验目标文件存在且不是目录
- 要求 old_text 恰好命中一次,避免误改或歧义编辑
- 使用临时文件替换方式写回,降低半写入风险
- 注册 fs_edit_file 到 builtin tools,并补充 prompt 中的工具使用提示
- 更新 README 与架构文档中的 filesystem 工具说明
- 补充 filesystem、bootstrap、prompt builder 相关测试
@wynxing wynxing closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants